package com.hzit.mmcb.core.controller.admin;


import com.hzit.common.result.R;
import com.hzit.mmb.base.utils.JwtUtils;
import com.hzit.mmcb.core.pojo.entity.BorrowInfo;
import com.hzit.mmcb.core.pojo.entity.IntegralGrade;
import com.hzit.mmcb.core.pojo.vo.BorrowInfoApprovalVO;
import com.hzit.mmcb.core.service.BorrowInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jdk.nashorn.internal.ir.IfNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 借款信息表 前端控制器
 * </p>
 *
 * @author ljh
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/admin/core/borrowInfo")
@Api(tags = "借款信息")
public class AdminBorrowInfoController {

    @Autowired
    private BorrowInfoService borrowInfoService;

    @GetMapping("/list")
    @ApiOperation("借款信息列表")
    public R list(){
        List<BorrowInfo> list=borrowInfoService.listAll();
        return R.ok().data("list",list);
    }

    @GetMapping("/show/{id}")
    @ApiOperation("查询借款人信息")
    public R show(@PathVariable @ApiParam("借款人id")Integer id){
        Map<String,Object> map=borrowInfoService.show(id);
        return R.ok().data("borrowInfoDetail",map);
    }

    @PostMapping("/approval")
    @ApiOperation("/审核")
    public R approval(@RequestBody @ApiParam("审核表单信息")BorrowInfoApprovalVO vo){
        borrowInfoService.approval(vo);
        return R.ok().message("审核完成");
    }

}

